$(function(){
  var index = {
    init: function () {
      this.queryHospitals();
    },
    queryHospitals: function () {
      publicAjax(basePath + 'hospitals', 'post', null, function (data) {
        console.log(data)
        if (data.ret === 1) {
          var mainEl = $('main').empty();
          // 拼接数据
          var str = '',
            type = data.data,
            template = $($('#type-list').html()).clone();
          for (var i = 0; i < type.length; i++) {
            for (var m = 0; m < type[i].list.length; m++) {
              str += (
                '<li class="col-md-4">' +
                  '<a href="' + basePath + 'html/hospital/rybz.html?id=' + type[i].list[m].id + '&typeId=' + type[i].id + '&type=2&name=' + type[i].list[m].name + '">' +
                    type[i].list[m].name +
                  '</a>' +
                '</li>'
              );
            }
          }
          template.find('.hospital-list').html(str);
          mainEl.append(template);
        } else {
          flavrShowByTime(data.msg, null, 'error', false);
        }
      });
    }
  };

  index.init();
});